<!--
 * @Author: humengchuan 531537052@qq.com
 * @Date: 2024-06-25 14:40:43
 * @LastEditors: humengchuan 531537052@qq.com
 * @LastEditTime: 2024-06-25 16:09:23
 * @FilePath: \project\node-project\website-admin\src\views\login\starSky.vue
 * @Description: 
-->
<template>
    <div class="starSky">
        <div class="layer1"></div>
        <div class="layer2"></div>
        <div class="layer3"></div>
        <div class="layer4"></div>
        <div class="layer5"></div>
    </div>
</template>

<script lang="ts" setup>

</script>

<style lang="scss" scoped>
@use "sass:math";
@function getShadows($n) {
    $shadows: '#{random(100)}vw #{random(100)}vh #fff';
    @for $i from 2 through $n {
        $shadows: '#{$shadows}, #{random(100)}vw #{random(100)}vh #fff';
    }
    @return unquote($shadows);
}

.starSky {
    background-color: #2A3950;
    width: 100%;
    height: 100%;
    $duration: 500s;
    $count: 1000;
    @for $i from 1 through 5 {
        $duration: calc($duration / 2);
        $count: floor(math.div($count, 2));
        .layer#{$i} {
            $size: #{$i}px;
            position: fixed;
            width: $size;
            height: $size;
            background-color: #fff;
            border-radius: 50%;
            top: 0;
            left: 0;
            box-shadow: getShadows($count);
            animation: moveUp $duration linear infinite;
            &::after{
                content: '';
                position: fixed;
                top: 100vh;
                left: 0;
                border-radius: inherit;
                width: inherit;
                height: inherit;
                box-shadow: inherit;
            }
        }
    }

    @keyframes moveUp {
        to {
            transform: translateY(-100vh);
        }
    }
}
</style>